package harness;

public class Random {

    private int seed;

    public Random(int seed) {
        this.seed = seed;
    }

    /** returns pseudorandom x satisfying 0 <= x < n. **/
    public int nextInt() {
        seed ^= seed << 6;
        seed ^= seed >>> 21;
        seed ^= seed << 7;
        return (seed < 0 ? -seed : seed);
    }

    /** returns pseudorandom x satisfying 0 <= x < n. **/
    public int nextInt(int n) {
        seed ^= seed << 6;
        seed ^= seed >>> 21;
        seed ^= seed << 7;
        return (seed % n < 0 ? -(seed % n) : seed % n);
    }
}